﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Data.Linq;

namespace ALiteTeam.PackageTracer.Data
{
    public class ExpressTracerDB : DataContext
    {
        private static readonly string _connStr = "Data Source=isostore:/ExpressTracerDB.sdf";

        private static readonly ExpressTracerDB _Instance;
        public static ExpressTracerDB Instance
        {
            get
            {
                return _Instance;
            }
        }

        static ExpressTracerDB()
        {
            _Instance = new ExpressTracerDB();

            if (_Instance.DatabaseExists() == false)
            {
                _Instance.CreateDatabase();
            }
        }        

        private ExpressTracerDB()
            : base(_connStr)
        { }

        public Table<DeliveryOrder> DeliveryOrders
        {
            get
            {
                return this.GetTable<DeliveryOrder>();
            }
        }
    }
}
